package de.mizi.controller;

import de.mizi.tilemap.object.LocatableTilemapObject;
import de.mizi.tilemap.object.TilemapObjectDrawData;

/**
 * Represents an event of a specific type.
 * @author mizi
 *
 */
public class GameEvent {
	public final GameEventType eventType;
	
	private TilemapObjectDrawData[][] mapLayout;
	private LocatableTilemapObject objectData;
	private String newMessage;
	private int x;
	private int y;
	private boolean booleanValue;
	
	/**
	 * Constructs a new map layout event.
	 * @param mapLayout the new map layout
	 */
	public GameEvent(TilemapObjectDrawData[][] mapLayout) {
		this.eventType = GameEventType.NEW_MAP_LAYOUT;
		this.mapLayout = mapLayout;
	}
	
	/**
	 * Constructs a new LocatableTilemapObject event.
	 * @param eventType the concrete event type
	 * @param objectData the new object data
	 */
	public GameEvent(GameEventType eventType, LocatableTilemapObject objectData) {
		this.eventType = eventType;
		this.objectData = objectData;
	}
	
	/**
	 * Constructs a new boolean event.
	 * @param eventType the concrete event type
	 * @param booleanValue the new boolean value
	 */
	public GameEvent(GameEventType eventType, boolean booleanValue) {
		this.eventType = eventType;
		this.booleanValue = booleanValue;
	}
	
	/**
	 * Constructs a new message event.
	 * @param newMessage the new message that shall be added
	 */
	public GameEvent(String newMessage) {
		this.eventType = GameEventType.NEW_MESSAGE;
		this.newMessage = newMessage;
	}
	
	/**
	 * Constructs a new position changed event.
	 * @param eventType the concrete event type
	 * @param x the new x position
	 * @param y the new y position
	 */
	public GameEvent(GameEventType eventType, int x, int y) {
		this.eventType = eventType;
		this.x = x;
		this.y = y;
	}
	
	/**
	 * Get the map layout.
	 * @return the map layout
	 */
	public TilemapObjectDrawData[][] getMapLayout() {
		return mapLayout;
	}

	/**
	 * Get the data of the new LocatableTilemapObject.
	 * @return the new object data
	 */
	public LocatableTilemapObject getObjectData() {
		return objectData;
	}

	/**
	 * Get the new message.
	 * @return the new message
	 */
	public String getNewMessage() {
		return newMessage;
	}

	/**
	 * Get the new x position.
	 * @return the new x position
	 */
	public int getX() {
		return x;
	}

	/**
	 * Get the new y position.
	 * @return the new y position
	 */
	public int getY() {
		return y;
	}
	
	/**
	 * Get the boolean value.
	 * @return the new boolean value
	 */
	public boolean getBooleanValue() {
		return booleanValue;
	}
}
